import { createApp } from 'vue'
import App from './App'
import Cookies from 'js-cookie'
import router from './router'
import plugins from './plugins' // plugins
import ElementPlus from 'element-plus';
import 'element-plus/theme-chalk/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import '@/assets/styles/index.scss' // global css
import * as ElIconModules from '@element-plus/icons-vue'
import Pagination from '@/components/Pagination'

const app = createApp(App)

// 统一注册Icon图标
for (const iconName in ElIconModules) {
  if (Reflect.has(ElIconModules, iconName)) {
    const item = ElIconModules[iconName]
    app.component(iconName, item)
  }
}
//组件注册
app.component('Pagination', Pagination)
//组件注册
app.use(plugins)

// 使用element-plus 并且设置全局的大小
app.use(ElementPlus, {
  locale: locale,
  // 支持 large、default、small
  size: Cookies.get('size') || 'default'
})

app.use(router)
app.mount('#app')
